package online.shenme.day14_self.service;

import online.shenme.day14_self.dao.ManagerDAO;
import online.shenme.day14_self.dao.SubwaysDAO;
import online.shenme.day14_self.domin.Subway;

import java.util.HashMap;

public class ManageService implements Service{
    SubwaysDAO sd=new SubwaysDAO();
    ManagerDAO md=new ManagerDAO();

    @Override
    public boolean put(String code, String name, String belong) {
        return sd.add(code,new Subway(code,name,belong));
    }

    @Override
    public HashMap<String, Subway> findAll() {
        return sd.findAll();
    }

    public boolean load(String id, String name) {
        return md.getById(id) != null && name.equals(md.getById(id).getName());
    }
}
